import time
import traceback
import random

from MyTools.myutils import TestUtils
import pdb

# self.click_when_visible('')
cookie_str = 'Admin-Expires-In=1440; sidebarStatus=0; Admin-Token=c3f64485-fd6e-4910-a82b-ce6b6d2b66ad; SECKEY_ABVK=xMue/s1kyC/V9dBuwcl0oCop1ISns13saPn8GIvuW9M=; BMAP_SECKEY=2EtMLrnl8qsLazv-pcjV9zqpT_5nk98636xO0gZtPJjHJgQ1BO-zZXTz_f1STdDZQNp4dC7WAIBJjaYE8OfOD5Ws3dN9axNzJQd7MmHo5zsyNunHT5FLJ8Z-1eCyoYXXXv3xgkpsdWYHu6AmDIxv6YzhYM-Vr8xp9dquT-nY9VL0EJBSoIknZp7E_6Dz9uwz; integrated-platform-Token=fa999fac-4b89-4495-aa43-33eea59e284d'
sj_number = str(random.randint(10000, 99999))

class MytestClass(TestUtils):

    ######################## 线索公海(自领取) ########################
    # 线索公海(自领取)
    def do_crm_ClueManagement_CluePublicSea_SelfClaim_nocompany(self):

        try:
            self.cookie_adder(cookie_str)
            self.check_status(self)
            self.maximize_window()

            self.open("http://10.0.0.75:811/applicate/clue")

            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.tabs > div > div > div:nth-child(2) > div')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.clue > section > section > main > div.toolbar.el-row > div:nth-child(1) > button')

            # 线索名称
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(1) > div > div > div.el-input.el-input--small > input',"公海线索_自领取"+sj_number)
            # 线索来源
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 公司名称

            # 行业
            self.actions_tab(2)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_down(1)
            self.actions_right(1)
            self.actions_enter(1)
            time.sleep(1)
            # 客户级别
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(5) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(1)
            self.actions_enter(1)
            # 联系人
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(6) > div > div > div > input','联系人'+sj_number)
            # 手机号
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(7) > div > div > div > input','131859'+sj_number)
            # 岗位/职务
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(8) > div > div > div > input','岗位'+sj_number)
            # 员工数量
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(9) > div > div > div > input',sj_number)
            # 年营业额
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(10) > div > div > div > input','3'+sj_number)
            # 微信
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(1) > div > div > div > input','WX'+sj_number)
            # QQ
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(2) > div > div > div > input','35'+sj_number)
            # 邮箱
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(3) > div > div > div > input',sj_number+'@qq.com')
            # 地址
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.el-input.el-input--small > input','福建省福州市台江区悦发广场')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.fun-more.ly-flex-pack-center.ly-flex-align-center > i')
            time.sleep(1)
            self.click_when_visible('body > div.el-dialog__wrapper > div > div.el-dialog__footer > div > button.el-button.el-button--primary.el-button--medium')
            # 所属公海
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(1) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(1)
            self.actions_enter(1)
            # 产品线
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 备注
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(3) > div > div > div > input','备注测试：'+sj_number)
            # 选择商品
            self.click_when_visible('#pane-1 > div > div.functional-block-main > div.functional-block-main-fun > button')
            self.send_keys('body > div.el-drawer__wrapper > div > div > section > section > header > form > div:nth-child(1) > div > div > input','云商城商品')
            self.actions_tab(3)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_tab(4)
            time.sleep(1)
            self.actions_space(1)
            self.actions_tab(8)
            self.actions_enter(1)
            time.sleep(1)
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-footer > button.el-button.el-button--primary.el-button--small')

            pdb.set_trace()#断点
        except Exception as e:
            print("@@@@@@@@@@@@@@@@@@@@ 出现错误了先暂停一下，方便调试！@@@@@@@@@@@@@@@@@@@@@@@@")
            tb_str = traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__)
            print(f"抱歉，出现错误：{str(e)}")
            print("".join(tb_str))  # 显示详细的错误追踪信息，包括在哪一行代码触发的错误
            pdb.set_trace()
    # 线索管理(需分配)
    def do_crm_ClueManagement_CluePublicSea_NeedsAllocation_nocompany(self):
        try:
            self.cookie_adder(cookie_str)
            self.check_status(self)
            self.maximize_window()

            self.open("http://10.0.0.75:811/applicate/clue")

            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.tabs > div > div > div:nth-child(2) > div')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.clue > section > section > main > div.toolbar.el-row > div:nth-child(1) > button')

            # 线索名称
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(1) > div > div > div.el-input.el-input--small > input',"公海线索_需分配"+sj_number)
            # 线索来源
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 公司名称

            # 行业
            self.actions_tab(2)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_down(1)
            self.actions_right(1)
            self.actions_enter(1)
            time.sleep(1)
            # 客户级别
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(5) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(1)
            self.actions_enter(1)
            # 联系人
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(6) > div > div > div > input','联系人'+sj_number)
            # 手机号
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(7) > div > div > div > input','131859'+sj_number)
            # 岗位/职务
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(8) > div > div > div > input','岗位'+sj_number)
            # 员工数量
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(9) > div > div > div > input',sj_number)
            # 年营业额
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(10) > div > div > div > input','3'+sj_number)
            # 微信
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(1) > div > div > div > input','WX'+sj_number)
            # QQ
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(2) > div > div > div > input','35'+sj_number)
            # 邮箱
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(3) > div > div > div > input',sj_number+'@qq.com')
            # 地址
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.el-input.el-input--small > input','福建省福州市台江区悦发广场')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.fun-more.ly-flex-pack-center.ly-flex-align-center > i')
            time.sleep(1)
            self.click_when_visible('body > div.el-dialog__wrapper > div > div.el-dialog__footer > div > button.el-button.el-button--primary.el-button--medium')
            # 所属公海
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(1) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(4)
            self.actions_enter(1)
            # 产品线
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 备注
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(3) > div > div > div > input','备注测试：'+sj_number)
            # 选择商品
            self.click_when_visible('#pane-1 > div > div.functional-block-main > div.functional-block-main-fun > button')
            self.send_keys('body > div.el-drawer__wrapper > div > div > section > section > header > form > div:nth-child(1) > div > div > input','云商城商品')
            self.actions_tab(3)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_tab(4)
            time.sleep(1)
            self.actions_space(1)
            self.actions_tab(8)
            self.actions_enter(1)
            time.sleep(1)
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-footer > button.el-button.el-button--primary.el-button--small')

            pdb.set_trace()#断点
        except Exception as e:
            print("@@@@@@@@@@@@@@@@@@@@ 出现错误了先暂停一下，方便调试！@@@@@@@@@@@@@@@@@@@@@@@@")
            tb_str = traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__)
            print(f"抱歉，出现错误：{str(e)}")
            print("".join(tb_str))  # 显示详细的错误追踪信息，包括在哪一行代码触发的错误
            pdb.set_trace()
    # 线索管理(需申请)
    def do_crm_ClueManagement_CluePublicSea_NeedsApplication_nocompany(self):
        try:
            self.cookie_adder(cookie_str)
            self.check_status(self)
            self.maximize_window()

            self.open("http://10.0.0.75:811/applicate/clue")

            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.tabs > div > div > div:nth-child(2) > div')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.clue > section > section > main > div.toolbar.el-row > div:nth-child(1) > button')

            # 线索名称
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(1) > div > div > div.el-input.el-input--small > input',"公海线索_需申请"+sj_number)
            # 线索来源
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 公司名称

            # 行业
            self.actions_tab(2)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_down(1)
            self.actions_right(1)
            self.actions_enter(1)
            time.sleep(1)
            # 客户级别
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(5) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(1)
            self.actions_enter(1)
            # 联系人
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(6) > div > div > div > input','联系人'+sj_number)
            # 手机号
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(7) > div > div > div > input','131859'+sj_number)
            # 岗位/职务
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(8) > div > div > div > input','岗位'+sj_number)
            # 员工数量
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(9) > div > div > div > input',sj_number)
            # 年营业额
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(10) > div > div > div > input','3'+sj_number)
            # 微信
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(1) > div > div > div > input','WX'+sj_number)
            # QQ
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(2) > div > div > div > input','35'+sj_number)
            # 邮箱
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(3) > div > div > div > input',sj_number+'@qq.com')
            # 地址
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.el-input.el-input--small > input','福建省福州市台江区悦发广场')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.fun-more.ly-flex-pack-center.ly-flex-align-center > i')
            time.sleep(1)
            self.click_when_visible('body > div.el-dialog__wrapper > div > div.el-dialog__footer > div > button.el-button.el-button--primary.el-button--medium')
            # 所属公海
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(1) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(5)
            self.actions_enter(1)
            # 产品线
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 备注
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(3) > div > div > div > input','备注测试：'+sj_number)
            # 选择商品
            self.click_when_visible('#pane-1 > div > div.functional-block-main > div.functional-block-main-fun > button')
            self.send_keys('body > div.el-drawer__wrapper > div > div > section > section > header > form > div:nth-child(1) > div > div > input','云商城商品')
            self.actions_tab(3)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_tab(4)
            time.sleep(1)
            self.actions_space(1)
            self.actions_tab(8)
            self.actions_enter(1)
            time.sleep(1)
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-footer > button.el-button.el-button--primary.el-button--small')

            pdb.set_trace()#断点
        except Exception as e:
            print("@@@@@@@@@@@@@@@@@@@@ 出现错误了先暂停一下，方便调试！@@@@@@@@@@@@@@@@@@@@@@@@")
            tb_str = traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__)
            print(f"抱歉，出现错误：{str(e)}")
            print("".join(tb_str))  # 显示详细的错误追踪信息，包括在哪一行代码触发的错误
            pdb.set_trace()
    # 线索管理(需分配且自领取)
    def do_crm_ClueManagement_CluePublicSea_NeedsAllocationAndSelfClaim_nocompany(self):
        try:
            self.cookie_adder(cookie_str)
            self.check_status(self)
            self.maximize_window()

            self.open("http://10.0.0.75:811/applicate/clue")

            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.tabs > div > div > div:nth-child(2) > div')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.clue > section > section > main > div.toolbar.el-row > div:nth-child(1) > button')

            # 线索名称
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(1) > div > div > div.el-input.el-input--small > input',"公海线索_需分配且自领取"+sj_number)
            # 线索来源
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 公司名称

            # 行业
            self.actions_tab(2)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_down(1)
            self.actions_right(1)
            self.actions_enter(1)
            time.sleep(1)
            # 客户级别
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(5) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(1)
            self.actions_enter(1)
            # 联系人
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(6) > div > div > div > input','联系人'+sj_number)
            # 手机号
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(7) > div > div > div > input','131859'+sj_number)
            # 岗位/职务
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(8) > div > div > div > input','岗位'+sj_number)
            # 员工数量
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(9) > div > div > div > input',sj_number)
            # 年营业额
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(10) > div > div > div > input','3'+sj_number)
            # 微信
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(1) > div > div > div > input','WX'+sj_number)
            # QQ
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(2) > div > div > div > input','35'+sj_number)
            # 邮箱
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(3) > div > div > div > input',sj_number+'@qq.com')
            # 地址
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.el-input.el-input--small > input','福建省福州市台江区悦发广场')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.fun-more.ly-flex-pack-center.ly-flex-align-center > i')
            time.sleep(1)
            self.click_when_visible('body > div.el-dialog__wrapper > div > div.el-dialog__footer > div > button.el-button.el-button--primary.el-button--medium')
            # 所属公海
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(1) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(2)
            self.actions_enter(1)
            # 产品线
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 备注
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(3) > div > div > div > input','备注测试：'+sj_number)
            # 选择商品
            self.click_when_visible('#pane-1 > div > div.functional-block-main > div.functional-block-main-fun > button')
            self.send_keys('body > div.el-drawer__wrapper > div > div > section > section > header > form > div:nth-child(1) > div > div > input','云商城商品')
            self.actions_tab(3)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_tab(4)
            time.sleep(1)
            self.actions_space(1)
            self.actions_tab(8)
            self.actions_enter(1)
            time.sleep(1)
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-footer > button.el-button.el-button--primary.el-button--small')

            pdb.set_trace()#断点
        except Exception as e:
            print("@@@@@@@@@@@@@@@@@@@@ 出现错误了先暂停一下，方便调试！@@@@@@@@@@@@@@@@@@@@@@@@")
            tb_str = traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__)
            print(f"抱歉，出现错误：{str(e)}")
            print("".join(tb_str))  # 显示详细的错误追踪信息，包括在哪一行代码触发的错误
            pdb.set_trace()
    # 线索管理(需分配且需申请)
    def do_crm_ClueManagement_CluePublicSea_NeedsAllocationAndApplication_nocompany(self):
        try:
            self.cookie_adder(cookie_str)
            self.check_status(self)
            self.maximize_window()

            self.open("http://10.0.0.75:811/applicate/clue")

            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.tabs > div > div > div:nth-child(2) > div')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.clue > section > section > main > div.toolbar.el-row > div:nth-child(1) > button')

            # 线索名称
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(1) > div > div > div.el-input.el-input--small > input',"公海线索_需分配且需申请"+sj_number)
            # 线索来源
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 公司名称

            # 行业
            self.actions_tab(2)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_down(1)
            self.actions_right(1)
            self.actions_enter(1)
            time.sleep(1)
            # 客户级别
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(5) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(1)
            self.actions_enter(1)
            # 联系人
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(6) > div > div > div > input','联系人'+sj_number)
            # 手机号
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(7) > div > div > div > input','131859'+sj_number)
            # 岗位/职务
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(8) > div > div > div > input','岗位'+sj_number)
            # 员工数量
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(9) > div > div > div > input',sj_number)
            # 年营业额
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(2) > div > div:nth-child(10) > div > div > div > input','3'+sj_number)
            # 微信
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(1) > div > div > div > input','WX'+sj_number)
            # QQ
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(2) > div > div > div > input','35'+sj_number)
            # 邮箱
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(3) > div > div > div > input',sj_number+'@qq.com')
            # 地址
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.el-input.el-input--small > input','福建省福州市台江区悦发广场')
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(5) > div > div:nth-child(4) > div > div > div > div.fun-more.ly-flex-pack-center.ly-flex-align-center > i')
            time.sleep(1)
            self.click_when_visible('body > div.el-dialog__wrapper > div > div.el-dialog__footer > div > button.el-button.el-button--primary.el-button--medium')
            # 所属公海
            self.sendkey_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(1) > div > div > div > div.el-input.el-input--small.el-input--suffix > input','enter')
            self.actions_down(3)
            self.actions_enter(1)
            # 产品线
            self.actions_tab(1)
            self.actions_down(1)
            self.actions_enter(1)
            # 备注
            self.send_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-main > div > div:nth-child(1) > div > div:nth-child(8) > div > div:nth-child(3) > div > div > div > input','备注测试：'+sj_number)
            # 选择商品
            self.click_when_visible('#pane-1 > div > div.functional-block-main > div.functional-block-main-fun > button')
            self.send_keys('body > div.el-drawer__wrapper > div > div > section > section > header > form > div:nth-child(1) > div > div > input','云商城商品')
            self.actions_tab(3)
            self.actions_enter(1)
            time.sleep(1)
            self.actions_tab(4)
            time.sleep(1)
            self.actions_space(1)
            self.actions_tab(8)
            self.actions_enter(1)
            time.sleep(1)
            self.click_when_visible('#app > div > div.app-wrapper__container.ly-flex-1 > div.main-container.hasTagsView > section > div > div > div.addClue-body > form > div.addClue-body-footer > button.el-button.el-button--primary.el-button--small')

            pdb.set_trace()#断点
        except Exception as e:
            print("@@@@@@@@@@@@@@@@@@@@ 出现错误了先暂停一下，方便调试！@@@@@@@@@@@@@@@@@@@@@@@@")
            tb_str = traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__)
            print(f"抱歉，出现错误：{str(e)}")
            print("".join(tb_str))  # 显示详细的错误追踪信息，包括在哪一行代码触发的错误
            pdb.set_trace()

    def test_crm_pm_jxc(self):
        self.open("http://10.0.0.75:811/index")
        # 线索公海(自领取)
        self.do_crm_ClueManagement_CluePublicSea_SelfClaim_nocompany()
        # 线索管理(需分配)
        self.do_crm_ClueManagement_CluePublicSea_NeedsAllocation_nocompany()
        # 线索管理(需申请)
        self.do_crm_ClueManagement_CluePublicSea_NeedsApplication_nocompany()
        # 线索管理(需分配且自领取)
        self.do_crm_ClueManagement_CluePublicSea_NeedsAllocationAndSelfClaim_nocompany()
        # 线索管理(需分配且需申请)
        self.do_crm_ClueManagement_CluePublicSea_NeedsAllocationAndApplication_nocompany()